/////////////////////////////////////////////////////////////////////////////
//
//
//Created:               190915 Xue Zhaojie
//1st version Finished:
//Modified:
//
//
//////////////////////////////////////////////////////////////////////////////

package app;

import datastructure.Instance;
import datastructure.Solution;

import java.io.IOException;
import java.util.Calendar;

public class functionMain {

    public static void main(String[] args) throws IOException {

        int experimentnumber = 1;

        Calendar c = Calendar.getInstance();
        String year = c.get(Calendar.YEAR) + "";
        String month = (c.get(Calendar.MONTH) + 1) + "";
        String date = c.get(Calendar.DATE) + "";
        String hour = c.get(Calendar.HOUR_OF_DAY) + "";
        String minute = c.get(Calendar.MINUTE) + "";
        String second = c.get(Calendar.SECOND) + "";

        String time = year + month + date + hour + minute + second;

        double starttime, endtime;

// for_uniform
//        int divide = 13;
//        Instance instance = new Instance();
//        Generator_U instanceGenerator = new Generator_U();
////        instance = instanceGenerator.generate(divide, experimentnumber,time);
////        instanceGenerator.fileOutput(divide,experimentnumber,time);
//        instance = instanceGenerator.fileInput(divide,experimentnumber,time);
//        instance.deltaAdd();

// for_random
        int nodes = 30;
        Instance instance = new Instance();
        Generator_R instanceGenerator = new Generator_R();
//        instance = instanceGenerator.generate(nodes, experimentnumber,time);
//        instanceGenerator.fileOutput(nodes,experimentnumber,time);
        instance = instanceGenerator.fileInput(nodes, experimentnumber, time);
        instance.deltaAdd();

// draw_graph
        Drawgraph drawgraph = new Drawgraph(instance, experimentnumber, time);
        drawgraph.draw();
        starttime = System.currentTimeMillis();
// VNS
        Solution solution = new Solution();
        VNSprocess VNS = new VNSprocess(instance, experimentnumber, time);
        solution = VNS.Iter(VNS);
        endtime = System.currentTimeMillis();
        System.out.println("CPU Time ：");
        System.out.println((endtime - starttime) / 1000);

        DataRecord datarecord = new DataRecord(instance, experimentnumber, time);
        datarecord.data(solution);
    }
}


